package com.cakebackoffice.clientsoap.contract;


import org.ksoap2.serialization.SoapObject;

public class Store extends ContractObject {
    public int id;
    public String name;
    public Address adress;

    public Store() {
    }

    public Store(com.cakebackoffice.Model.Store selectedStore) {
        if (selectedStore.getRemoteID() != null)
            id = Integer.valueOf(selectedStore.getRemoteID().toString());
        name = selectedStore.getName();
        if (selectedStore.getPlace() != null)
            adress = new Address(selectedStore.getPlace().getAddress());
    }

    @Override
    public void fill(SoapObject soapObject) {
        this.id = Integer.parseInt(soapObject.getPropertySafelyAsString("id"));
        this.name = soapObject.getPropertySafelyAsString("name").trim();
        this.adress = new Address();
        if (soapObject.getPropertySafely("address") != null)
            this.adress.fill((SoapObject) soapObject.getPropertySafely("address"));
    }
}
